import type { UserInfo } from '@/api/login/type'
import { request } from '@/utils/axios/axios'
import type { PageNationParams, PageNationResult } from '@/api/user/type'

enum API {
  USER = 'user',
}

// 发送添加用户请求
export const addUser = (userVo: UserInfo) => {
  return request.post<UserInfo>(API.USER, userVo)
}

// 分页用户信息请求
export const paginationQuery = (data: PageNationParams): Promise<PageNationResult> => {
  return request.get<PageNationParams, PageNationResult>(API.USER, { params: data })
}
// 给用户分配角色
export const assignRoleRequest = (userId: number, data: string[]) => {
  return request.post<UserInfo>(API.USER + `/${userId}`, data)
}
// 删除用户
export const deleteUsersRequest = (userIds: number[]) => {
  return request.delete(API.USER, { data: userIds })
}
